Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 57 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughUpdated the bot-membership handler's "TEMP_groups" migration logic to optimize group lookups. When a chat ID already exists in TEMP_redis, the middleware now skips the backend group lookup and immediately proceeds. Additionally, successful backend group lookups are now cached in TEMP_redis for future requests. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/middlewares/bot-membership-handler.ts`:
- Around line 55-60: The current flow returns immediately when redisCheck is
truthy and writes a permanent entry via this.TEMP_redis.write after a successful
backend query (api.tg.groups.getById.query), which can permanently skip future
reconciliation; update the TEMP cache usage so writes include an expiration
(TTL) and/or add an existence verification step: when calling
this.TEMP_redis.write(ctx.chat.id.toString(), ctx.chat.id) use the cache
client's TTL-aware API (or wrap writes to store an expiry) and ensure the
redisCheck path validates age/expiry (or performs a lightweight recheck) before
returning next(), and add explicit invalidation hooks where backend removals
occur so stale keys are removed.
- Line 57: The current call to api.tg.groups.getById.query is swallowing all
errors via .catch(() => null) which conflates transport/runtime failures with a
genuine "not found" and can incorrectly trigger GroupManagement.create; replace
the single-line .catch by explicitly distinguishing not-found (e.g., check for a
404/NotFound error from the API) from other errors: perform the call inside a
try/catch, return null only when the caught error indicates the group is absent,
and rethrow or propagate any other error so that backend failures are not
treated as "missing" (refer to the api.tg.groups.getById.query invocation and
the downstream GroupManagement.create usage to ensure the control flow is
corrected).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a9b73114-389f-45ed-b41b-450c990b1eb1
📒 Files selected for processing (1)
src/middlewares/bot-membership-handler.ts
No description provided.